<?php use_helper('Pagination') ?>
<?php slot('coursesNav', 'active') ?>
<div class="courses" id="wrapper">
	<?php include_partial('global/systemMessages') ?>
	<div id="content">
		<div id="main">			
			<div class="main-heading">
				<?php include_component('notes','filter', array("semester_id" => $semester_id)) ?>
				<h1><?php echo $course->getSubject() ? $course->getSubject()->getName(). ': ' : '' ?><?php echo $course->getName() ?></h1>
			</div>
			<!--  EVENTUALLY SORT CHRONOLOGICALLY AND BY POPULARITY AND/OR RATING? -->
			<ul class="filter-links">
				<li class="current">
					<a href="#">By Lecture</a>
				</li>
				<!--<li><a href="#">Most Recent</a></li>-->
			</ul>
	<?php	if(!isset($notes_pager) || $notes_pager == null || $notes_pager->getNbResults() == 0 ): ?>
				<div class="non-member">
					<h1>There are no notes for this class yet.</h1>
					<?php echo ($semester_id ? "<br><h2 align='center'>Also try searching for 'All' Semesters</h2><br>" : "") ?>
						<p>This class currently contains no lecture notes. Once the notes have been taken, you'll be able to view them, comment on them, and rate them. You'll see all the lectures for this class in a list, just like the sample shown below.</p>
						<p style="font-style: italic; text-align: center;">If Notes are available for other semesters in which this course has been offered,<br/>an option to change semesters will appear above this box.</p>
						<div class="buttons">
							<?php echo link_to('Start Writing Notes', 'notes/new?course_id='.$course_id, 
																array('class' => 'btn_start-writing-notes')
							)?>
						</div>
				</div>
				<img alt="Sample view" src="/images/img_sample_notes-listing.jpg"/>
			<?php else: ?>
				<?php include_partial('notes/list', 
													array('group_id' => $group_id,
														'course_id' => $course_id,
														'notes_pager' => $notes_pager,
														'page' => $page
																	)) ?>
			<?php endif ?>
		</div>
		<!-- MAIN -->
		<div id="sidebar">
			<div class="module study-groups">
				<h3 class="gradient light">Contribute To This Course</h3>
				<div class="inner">
					<ul>
						<li>
							<h4>
								<?php echo link_to('Post Your Course Notes', 'notes/new?course_id='.$course_id) ?>
							</h4>
						</li>
					</ul>
				</div>
			</div>
			<?php include_component('courses', 'about', array('course' => $course))?>
			
			<div class="module groups">
				<h3 class="gradient dark">
					<?php echo link_to('Create a Group', 'groups/edit')?>
					Study Groups 
				</h3>
				<div class="inner">
				<?php if(isset($groups) && $groups != null): ?>
					<ul>
						<?php foreach($groups as $group): ?>
						<li>
							<h4>
								<?php echo link_to($group->getName(), 'groups/show?id='.$group->getId()) ?>
							</h4>
							<p class="activity"><span class="stars three">3 stars</span>
							<?php echo $group->countGroupMembers() ?> members</p>
							<p><?php echo $group->getDescription() ?></p>
						</li>
						<?php endforeach ?>
					</ul>
				<?php else: ?>
					<div class="empty">
						<img alt="Sample view" src="/images/img_sample_groups-sidebar.jpg"/>
						<p>There are no groups for this course</p>
					</div>
				<?php endif ?>
				</div>
			</div>
		</div>
	</div>

</div>